﻿<UserControl x:Class="PCSWpfClient.View.InstrumentView"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
             
             mc:Ignorable="d" 
             d:DesignHeight="250" d:DesignWidth="600">

    
        

    
    <UserControl.Resources>
        <ResourceDictionary>
            <ResourceDictionary.MergedDictionaries>
                <ResourceDictionary  Source="..\Resources\PriceResource.xaml" />
            </ResourceDictionary.MergedDictionaries>
        </ResourceDictionary>
            
    </UserControl.Resources>


        <GroupBox HorizontalAlignment="Stretch" >
            <GroupBox.Header>Investment</GroupBox.Header>
            <Grid Margin="3">
                <Grid.ColumnDefinitions>
                    <ColumnDefinition />
                </Grid.ColumnDefinitions>
                <Grid.RowDefinitions>
                    <RowDefinition Height="Auto" />
                    <RowDefinition Height="*" />
                    <RowDefinition Height="Auto" />
                </Grid.RowDefinitions>
                <DockPanel  Grid.Row="0" Margin="2" >
                    <ComboBox  x:Name="InstrumentType_cmb" DockPanel.Dock="Left" 
                               Margin="2" 
                               MinWidth="100" 
                               ItemsSource="{Binding Source={StaticResource InstrumentTypeValues}}"
                               SelectedItem="{Binding CurrentInstrumentType, Mode=TwoWay}" SelectedIndex="0"                               />
                <ComboBox  x:Name="ItemsShortDoesNotContainAllInstruments" DockPanel.Dock="Left" 
                               Margin="2" 
                               MinWidth="100" 
                               ItemsSource="{Binding ShortInstrumentList}"
                           DisplayMemberPath="Name"
                               SelectedItem="{Binding CurrentInstrument, Mode=TwoWay}" 
                               IsEditable="{Binding IsEnabledComboEdit, Mode=TwoWay}" Text="{Binding CurrentInstrument.Name, Mode=TwoWay}"
                           IsReadOnly="True"/>
                <TextBox  DockPanel.Dock="Left" Margin="2" Text="{Binding Path=CurrentInstrument.Name, Mode=TwoWay}" />
                </DockPanel>
                <Grid Grid.Row="1">
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition Width="Auto"/>
                        <ColumnDefinition Width="4"/>
                        <ColumnDefinition Width="*"/>
                </Grid.ColumnDefinitions>
                    <Grid.RowDefinitions>
                        <RowDefinition Height="*" />
                    </Grid.RowDefinitions>
                    <ListBox Grid.Column="0" ItemsSource="{Binding Path=InstrumentView}" 
                             SelectedItem="{Binding Path=CurrentInstrument}"
                             SelectionMode="Single"
                             ScrollViewer.VerticalScrollBarVisibility="Visible"
                             ItemTemplateSelector="{Binding Source={StaticResource InstrumentTemplateSelector}}"
                             HorizontalContentAlignment="Stretch"
                             AlternationCount="2"
                             ItemContainerStyle="{StaticResource alternatingWithTriggers}">
                        
                    </ListBox>
            <GridSplitter ResizeDirection="Columns"  Grid.Column="1" Width="3" Height="Auto" 
            HorizontalAlignment="Stretch" 
            VerticalAlignment="Stretch" 
            Margin="0"/>
                    <DataGrid Grid.Column="2" ItemsSource="{Binding Path=PriceSeriesList}"
                              SelectedItem="{Binding CurrentPriceSeries}"
                              AutoGenerateColumns="False" IsReadOnly="true" CanUserAddRows="False">
                    <DataGrid.Columns>
                        <DataGridTextColumn Header="Name" Width="100*" Binding="{Binding Path=Name}"></DataGridTextColumn>
                        <DataGridCheckBoxColumn Header="Master" Width="50" Binding="{Binding Path=IsMaster}"/>
                        <DataGridTextColumn Header="TrackRecordType" Width="100*" Binding="{Binding Path=TrackRecordType}"></DataGridTextColumn>
                        <DataGridTextColumn Header="IdentifierA" Width="100*" Binding="{Binding Path=IdentifierA}" ></DataGridTextColumn>
                    </DataGrid.Columns>
                </DataGrid>
                </Grid>
             <TextBlock Text="{Binding Path=ExceptionText.Exception}" Grid.Column="0" Grid.ColumnSpan="3" Grid.Row="2"/>
        </Grid>
        </GroupBox>

</UserControl>
